(ffap-file-at-point): Try parent directories.
authorEli Zaretskii <eliz@is.elta.co.il>
Sat, 21 Feb 2004 13:41:04 +0000 (13:41 +0000)
committerEli Zaretskii <eliz@is.elta.co.il>
Sat, 21 Feb 2004 13:41:04 +0000 (13:41 +0000)
lisp/ffap.el

index 668700a5c1f23d57eaa547a2e19bff0e48c8e2a3..27abd52f5630f49b7d4ee630d83879ffe9c855e6 100644 (file)
@@ -1185,6 +1185,14 @@ which may actually result in an url rather than a filename."
                         remote-dir (substring name (match-end 1)))))
                  (ffap-file-exists-string
                   (ffap-replace-file-component remote-dir name))))))
+         ;; Try all parent directories by deleting the trailing directory
+         ;; name until existing directory is found or name stops changing
+         ((let ((dir name))
+            (while (and dir
+                        (not (ffap-file-exists-string dir))
+                        (not (equal dir (setq dir (file-name-directory
+                                                   (directory-file-name dir)))))))
+            (ffap-file-exists-string dir)))
         )
       (set-match-data data))))
 \f